package com.fowo.api.exportCenter.util;

import java.io.CharArrayWriter;
import java.io.PrintWriter;

public class PrintWriterCopier {
    private CharArrayWriter charArrayWriter;
    private PrintWriter writer;

    public PrintWriterCopier() {
        this.charArrayWriter = new CharArrayWriter();
        this.writer = new PrintWriter(charArrayWriter);
    }

    public PrintWriter getWriter() {
        return writer;
    }

    public char[] getCopy() {
        return charArrayWriter.toCharArray();
    }

    public byte[] getBytes() {
        return charArrayWriter.toString().getBytes();
    }
}
